package com.zqh.template.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/*
 * @description: 文件规则枚举
 * @author: zqh
 * @dateTime: 2025/2/20 18:16
 */
@AllArgsConstructor
@Getter
public enum FileFilterRuleEnum {

    CONTAINS("包含","contains"),
    STARTS_WITH("前级匹配", "startsWith"),
    ENDS_WITH("后缀匹配","endsWith"),
    REGEX("正则","regex"),
    EQUALS("相等","equals");


    private final String text;
    private final String value;

    /*
     * @description: 根据value获取枚举
     * @params: [value]
     * @return: com.zqh.template.enums.FileFilterRuleEnum
     * @author: zqh
     * @dateTime: 2025/2/14 21:04
     */
    public static FileFilterRuleEnum getEnumByValue(String value){


        if(ObjectUtil.isEmpty(value)) return null;

        for(FileFilterRuleEnum fileFilterRuleEnum: FileFilterRuleEnum.values()){
            if(fileFilterRuleEnum.value.equals(value)) return fileFilterRuleEnum;
        }

        return null;
    }



}
